//
//  MyAboutViewController.m
//  HubeiHotel
//
//  Created by LiBenCan on 17/11/22.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "MyAboutViewController.h"
#import "UILabel+HWDUILabel.h"
@interface MyAboutViewController ()<UIWebViewDelegate>

@property (nonatomic, strong) UIWebView *webView;

@end

@implementation MyAboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initTitleWithTitle:@"关于湖北酒店网"];
    [self.view addSubview:self.webView];
    [self getRequest];
}

-(UIWebView *)webView
{
    if (!_webView) {
        _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, SCREENW, SCREENH - 64)];
        _webView.delegate = self;
    }
    return _webView;
}

-(void)getRequest
{
    [HudHelper showProgressHudWithMessage:@"" toView:self.view];
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
        [HttpRequest PostrequestUrl:@"/other/aboutUs" Dic:@{} completion:^(NSDictionary *responseDic) {
            dispatch_async(dispatch_get_main_queue(), ^{
                if ([responseDic[@"success"] boolValue]) {
                    [_webView loadHTMLString:responseDic[@"data"][@"content"] baseURL:nil];
                }else{
                    [TomamaUI creatAlertWithTarget:self message:responseDic[@"msg"] timeInterval:2];
                }
            });
        }];
    });
}

-(void)webViewDidFinishLoad:(UIWebView *)webView
{
    [HudHelper hideHudToView:self.view];
}

-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    [TomamaUI creatAlertWithTarget:self message:@"加载失败" timeInterval:2];
    [HudHelper hideHudToView:self.view];
}

@end
